/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package mamayukero.problem.environment.component;

import java.awt.Point;
import java.util.ArrayList;

/**
 *
 * @author user1
 */
public class Warehouse {
	Point location;
        ArrayList<Machine> machines;
    
        public Warehouse() {
            location = new Point(0,0);
            machines = new ArrayList<Machine>();
        }
        
        public Warehouse(Point location) {
            this.location = location;
            machines = new ArrayList<Machine>();
        }
        
        public void setLocation(Point p) {
            location.setLocation(p);
	}
        
        public Point getLocation() {
            return location;
        }
        
        public ArrayList<Machine> getContainer() {
            return machines;
        }
        
        public Machine getMachine(int m) {
            return machines.get(m);
        }
        
        public void addMachine(Machine m) {
            machines.add(m);
        }
        
        public int sizeMachine() {
            return machines.size();
        }
        
        public int own(int d) {
            for (Machine m : machines) {
                if (m.type == d) {
                    return machines.indexOf(m);
                }
            }
            return -1;
        }
        
        public void remove(int d) {
            for (Machine m : machines) {
                if (m.type == d) {
                    machines.remove(m);
                    return;
                }
            }
        }
        
}
